package com.heima.pd.common.utils.threadlocal;
/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 */
public class BaseContext {
   private static ThreadLocal<String> threadLocal = new ThreadLocal<>();

    /*
     * 设置值
     * @param id
     */
    public static void setCurrentId(String id){
        threadLocal.set(id);
    }

    /*
     * 获取值
     * @return
     */
    public static String getCurrentId(){
        return threadLocal.get();
    }

    /*
     * 释放值
     */
    public static void removeCurrentId() {
        threadLocal.remove();
    }
}
